# OpenBSD -current related stuff

## Upgrade from OpenBSD -stable or -release to -current

**WARNING:** -current is mainly for developers working with OpenBSD itself, so it is possible you can have an unstable system at any point in time. Be sure to keep backup of important files before trying.

From your -stable or -release install, run this:

```sh
doas sysupgrade -s
```

You won't have to do anything else until the final reboot.

It will download some stuff and reboot by itself. On boot, it will autodetect a bsd.upgrade kernel and will boot from it, and select options automatically without having the user to do anything. So it's a form of unattended upgrade (they call it non-interactive upgrade). When upgrade is finished it will reboot once again. Then it's time to run:

```sh
doas pkg_add -Uu
doas sysmerge -d
```

## Get ports on -current

To not use CVS as root user:

```sh
$ su
# # will take effect on next user login
# user mod -G wsrc yourusername
# cd /usr
# mkdir -p ports
# chgrp wsrc ports
# chmod -R 775 ports
# exit
```

To get* ports from CVS:

```sh
$ cd /usr
$ # More mirrors available here: https://www.openbsd.org/anoncvs.html#CVSROOT
$ cvs -e ssh -d anoncvs@mirror.osn.de:/cvs get ports ports
$ # or...
$ cvs -qd anoncvs@mirror.osn.de:/cvs checkout -P ports
$ # rsync way would be:
$ rsync -av rsync://mirror.osn.de/openbsd-ports/ ports
```

\* rsync is better in case of inturruptions, errors etc. Though not all mirrors might have rsync support and the command may vary based on the mirror. Check the [mirror list](https://www.openbsd.org/anoncvs.html#CVSROOT) and visit mirror hosts for more info. If you get a `client_loop: send disconnect: Broken pipe` error due to network inturruptions during a CVS command, you may need to have [this config](https://unix.stackexchange.com/a/616355) applied.

To update ports later:

```sh
$ cd /usr/ports
$ # With cvs:
$ cvs -q up -Pd -A
$ # With rsync: run the rsync command again ?
```

**Ref:**
- Avoid Root Priviledges for CVS: <https://www.openbsd.org/faq/faq5.html#wsrc>
- Info about anoncvs: <https://www.openbsd.org/anoncvs.html>
